<template>
  <section class="common-dialog">
    <div class="header">
      <div class="title">
        <slot name="title" />
      </div>
      <i v-show="!hideClose" class="el-icon-close" @click="$parent.$emit('close')" />
    </div>
    <div class="content">
      <slot name="content" />
    </div>
    <div v-show="!hideFoot" class="footer">
      <slot name="footer" />
    </div>
  </section>
</template>

<style>
.v--modal-overlay .v--modal-box {
  overflow: initial;
  background: none;
}
</style>

<style lang="scss" scoped>
.common-dialog {
  color: #1c242c;
  background: white;
  border-radius: 6px;
}
.header {
  height: 56px;
  line-height: 56px;
  padding: 0 24px;
  position: relative;
  border-bottom: 1px solid #ebebeb;
  .title {
    font-size: 16px;
    font-weight: 500;
    font-family: PingFangSC-Medium, PingFang SC;
    color: rgba(0, 0, 0, 0.85);
  }
  > i {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    &:hover {
      opacity: 0.8;
    }
  }
}
.footer {
  text-align: right;
  padding: 10px 16px;
  position: relative;
  &::before {
    content: '';
    height: 1px;
    background-color: #ebebeb;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
  }
  div {
    width: auto;
    min-width: 60px;
    display: inline-block;

    & + div {
      margin-left: 10px;
    }
  }
  button {
    padding: 9px 20px;
    img {
      height: 50%;
      vertical-align: middle;
    }
    & + button {
      margin-left: 8px;
    }
  }
}
</style>

<script>
export default {
  name: 'CommonDialog',
  props: {
    hideClose: {
      type: Boolean,
      default: false
    },
    hideFoot: {
      type: Boolean,
      default: false
    }
  }
}
</script>
